package com.hand.prantice.ssm.service.impl;

import com.hand.prantice.ssm.domain.Permission;
import com.hand.prantice.ssm.domain.Role;
import com.hand.prantice.ssm.domain.User;
import com.hand.prantice.ssm.mapper.PermissionMapper;
import com.hand.prantice.ssm.mapper.UserMapper;
import com.hand.prantice.ssm.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author 马旭阳
 * @date2019/7/16
 */
@Service("userService")
public class UserServiceImpl implements IUserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<User> queryAllUser() {
        return userMapper.queryAllUser();
    }

    @Override
    public User queryUser(Long id) {
        return userMapper.queryUser(id);
    }

    @Override
    public List<Role> queryUserRole(Long id) {
        return userMapper.queryUserRole(id);
    }

    @Override
    public void insertUser(User user) {
        userMapper.insertUser(user);
    }

    @Override
    public void updateUser(User user) {
        userMapper.updateUser(user);
    }

    @Override
    public void deleteUser(User user) {
        userMapper.deleteUser(user);
    }

    @Override
    public List<User> queryUserByIds(List<Long> ids) {
        return userMapper.queryUserByIds(ids);
    }

    @Override
    public List<Permission> queryAll(Long userId) {
        return permissionMapper.queryAll(userId);
    }
}
